#include <iostream>
#include <cstring>
using namespace std;

/*
	带默认参数的构造函数写在类的外面
*/

class Cat
{
public:
	//天下无敌的版本
	Cat(string _name="旺财",int _age=0);
	
	void show()
	{
		cout<<"姓名: "<<name<<endl;
		cout<<"年龄: "<<age<<endl;
	}

private:
	int age;
	string name;
};

Cat::Cat(string _name,int _age) //默认参数在类的外面不能写
{
	name=_name;
	age=_age;
	cout<<"猫的构造函数带默认参数被调用了"<<endl;
}

int main(int argc,char **argv)
{
	//创建猫的对象
	Cat c2;
	Cat c3("阿福");
	Cat c4("阿黄",5);
	
	c2.show();
	c3.show();
	c4.show();
	return 0;	
}